#include <stdlib.h>
#include <stdio.h>
#include <string.h>

struct Stu
{
  int id;
  char name[50];
  struct Stu *next;
};

struct Stu *create(int n,int *id,char *name);
void Debug_print(struct Stu *head);

int ID[5] = {1,2,3,4,5};
char NAME[5] = {"ABCDE"};
// char NAME[5][50] = {"AAA","BBB","CCC","DDD","EEE"}; 


int main(void)
{
  int n = 5;
  struct Stu *head = NULL;//创建头指针

  // printf("请输入你想创建的节点个数:\r\n");
  // scanf("%d",&n);

  head = create(5,ID,NAME);
  Debug_print(head);
}


struct Stu *create(int n,int *id,char *name)
{
  struct Stu *head,*node,*end;//定义头结点，普通节点，尾节点

  head = (struct Stu *)malloc(sizeof(struct Stu));//给头结点申请内存
  end = head;//若是空表，则头尾地址一致

  for (size_t i = 0; i < n; i++)
  {
    node = (struct Stu *)malloc(sizeof(struct Stu));//给普通结点申请内存
    node->id = id[i];
    // strcpy(node->name,name[i]);
    end->next = node;
    end = node;
  }
  end->next = NULL;

  return head;
}


void Debug_print(struct Stu *head)
{
  struct Stu *p = head;
  p = p->next;
  while (p != NULL)
  {
    printf("%5d%10s\r\n",p->id,p->name);
    p = p->next;
  }
  
}